package xkp.lesson5;

import xkp.lesson4.Person;
import xkp.lesson4.Student;

public class 构造方法讲解 {
	public static void main(String[] args) {
		//每一个类如果不写构造方法，则有一个默认的无参构造方法
		Person person1 = new Person();
		Person person2 = new Person(10);
		System.out.println(person2.getAge());
		Person person3 = new Person("张三");
		System.out.println(person3.getName());
		Person person4 = new Person(20, "李四");
		System.out.println(person4.getName()+"---"+person4.getAge());
		//Person person = new Person();
		//在实例化子类的时候，会首先实例化父类的资源
		Student student = new Student();	
		//请问Person类目前有没有父类
		//在Java中Object是一切类的祖先
		person1.toString();
		
	}

}
